from django.shortcuts import render

from django.http import HttpResponse
# Create your views here.
from django.utils.decorators import method_decorator
from django.views.generic import View

def my_decorator(view):
    def my_deeeee(request,*args,**kwargs):
        print('装饰器被调用')
        print(request.method,request.path)
        return view(request,*args,**kwargs)
    return my_deeeee




# 定义类视图
# 类视图的定义和使用
@method_decorator(my_decorator,name='post')#另外一种装饰板器调用方法，更加精确。
class define_classview(View):
    def get(self,request):
        return HttpResponse('GET请求业务逻辑')
    def post(self,request):
        return HttpResponse('POST请求业务逻辑')